<template>
	<view class="list_item_m" @click="goDetail">
		<image :src="ImgUrl + item.img[0]" class="list_item_img_m" mode=""></image>
		<view class="list_item_right_m">
			<view class="list_item_right_title_m line-2">
				<text v-if=" item.is_prescription==1 " class="list_item_right_title_bq_m">处方药</text>
				{{item.name}}
			</view>
			<view class="flex_m">
				<view class="" style="color: #E5432E; align-items: baseline;">
					<text class="fs-28">¥</text>
					<text class="fs-40">{{item.price | pointsPrice}}</text>
					<text class="fs-28">.{{item.price | pointsPrice(1)}}</text>
				</view>
				<image @click.stop="clickaddshopcar" src="https://bucketoss10086.oss-cn-beijing.aliyuncs.com/images/add_acrt.png" class="add_yp_m"
					mode=""></image>
			</view>
			<view class="list_item_right_bottom_m">
				规格:{{ spec }}
				<text class="list_item_right_bottom_tiao_m">|</text>
				{{item.drug_shop}}
			</view>
		</view>
	</view>
</template>

<script>
	import {
		pointsPrice
	} from '@/utils/util1.js'
	import {
		addshopcar
	} from "@/api/common.js"
	export default {
		data() {
			return {};
		},
		computed: {
			ImgUrl() {
				return this.$store.state.ImgUrl
			},
			spec() {
				let specification = ''
				let skus = this.item.skus
				if (skus.length && skus[0].difference_text) {
					specification = skus[0].difference_text.join('*')
				}
				return specification
			}
		},
		props: {
			item: {
				type: Object,
				default: {}
			}
		},
		filters: {
			pointsPrice
		},
		methods: {
			go_DoctorDetails(data) {
				uni.navigateTo({
					url: '/pages/DoctorDetails/DoctorDetails?id=' + data.id
				})
			},
			goDetail(){
				uni.navigateTo({
					url:'/subPages/ShopingDetail/ShopingDetail?id=' + this.item.id
				})
			},
			clickaddshopcar(){
				let sku_id = this.item.skus[0].id || '';
				addshopcar({
					goods_id:this.item.id,
					sku_id,
					quantity:1
				}).then(res=>{
					console.log(res,'cs');
					uni.showToast({
						title:'加入成功',
						icon:'none'
					})
					setTimeout(()=>{
						uni.redirectTo({
							url:'/pages/ShoppingCart/ShoppingCart'
						})
					},800)
				})
			}
		}
	}
</script>

<style lang='scss' scoped>
	.list_item_m {
		width: 100%;
		border-bottom: 1rpx solid #F4F4F4;
		padding: 30rpx 0;
		box-sizing: border-box;
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.list_item_img_m {
		width: 200rpx;
		height: 200rpx;
		border-radius: 16rpx;
		background-color: #999;
	}

	.list_item_right_m {
		width: 446rpx;
	}

	.list_item_right_title_m {
		height: 80rpx;
		color: #333;
		text-overflow: ellipsis;
		font-family: Alibaba PuHuiTi 2.0;
		font-size: 28rpx;
		font-weight: 400;
	}

	.list_item_right_title_bq_m {
		display: inline-flex;
		padding: 2rpx 8rpx;
		border-radius: 8rpx 8rpx 0rpx 8rpx;
		background: linear-gradient(239deg, #FCF1CF 31.36%, #FAE6A5 68.64%);
		color: #5F360F;
		font-family: Alibaba PuHuiTi 2.0;
		font-size: 22rpx;
		font-weight: 400;
		margin-right: 5rpx;
	}

	.add_yp_m {
		width: 52rpx;
		height: 52rpx;
	}

	.flex_m {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-top: 20rpx;
	}

	.list_item_right_bottom_tiao_m {
		margin: 0 8rpx;
	}

	.list_item_right_bottom_m {
		color: #999;
		font-family: Alibaba PuHuiTi 2.0;
		font-size: 24rpx;
		font-weight: 400;
		margin-top: 10rpx;
	}
</style>